package 涂鸦智能;

/**
 @author fujiangnan
 @create 2021-09-26-21-41
 @desc ...
 */
public class Main2 {
    public static void main(String[] args) {

        String s = "dfa12321afd";
        int ans = secondHighest(s);
        System.out.println(ans);
    }
    public static int secondHighest (String s) {
        // write code here
        int max = -1;
        int submax = -1;
        for (int i = 0; i < s.length(); i++) {
            int temp = s.charAt(i) - '0';
            if (temp <= 9 && temp >= 0) {
                if (temp > max) {
                    submax = max;
                    max = temp;
                }
            }
        }
        return submax;
    }
}
